<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>
<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>
<?php echo $this->Form->create('NhaSanXuat',array('action'=>'admin_process')); ?>
<div class="head_title"><h1 align="center">Danh Sách Nhà Sản Xuất</h1></div>
<table>
    <thead>
    <tr>
		<th><?php echo $this->Form->checkbox('all',array('id'=>'checkall')); ?></th>
        <th scope="col" class="rounded-company"></th>
        <th scope="col" class="rounded">Mã Nhà Sản Xuất</th>
        <th scope="col" class="rounded">Tên Nhà Sản Xuất</th>
        <th scope="col" class="rounded">Địa Chỉ</th>
        <th scope="col" class="rounded">Thao Tác</th>
    </tr>

    </thead>
    <?php foreach($nhasanxuats as $nhasanxuat) : ?>
    <tr>
		<td>
			<?php echo $this->Form->checkbox('NhaSanXuat.id.'.$nhasanxuat['NhaSanXuat']['id']); ?>
		</td>
        <td>

        </td>
        <td>
            <?php echo $nhasanxuat['NhaSanXuat']['id']; ?>
        </td>
        <td>
            <?php echo $nhasanxuat['NhaSanXuat']['TENNSX']; ?>
        </td>
        <td>
            <?php echo $nhasanxuat['NhaSanXuat']['DIACHI']; ?>
        </td>
        <td>
            <?php
            if ($this->Session->read('quyen') != 'nhanvien') {
                echo $this->Html->link($this->Html->image('/images/user_edit.png'), array('action' => 'edit', $nhasanxuat['NhaSanXuat']['id']), array('escape' => false));
            } else echo '&nbsp';?>
            &nbsp;
            <?php if ($this->Session->read('quyen') == 'quantri') {
            echo $this->Html->link($this->Html->image('/images/trash.png'), array('action' => 'delete', $nhasanxuat['NhaSanXuat']['id']),
                array('confirm' => 'Bạn có chắc muốn xóa?', 'escape' => false));
        }

            ?>
        </td>
    </tr>
        <?php endforeach; ?>
</table>
<?php
     echo $this->Form->end('Xóa các mục đã chọn', array('action' => 'Delete'));
?>
<div id="pagination">
    <div class="paging">
        <?php echo $this->Paginator->first('Trang đầu'); ?>
        <?php echo $this->Paginator->prev('<<' . __('Lùi', true),
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->numbers(); ?>
        <?php echo $this->Paginator->next(__('Tới', true) . '>>',
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->last('Trang cuối'); ?>
    </div>
</div>
    <?php echo $this->Html->link('Thêm nhà sản xuất', array('action' => 'add'), array('class' => 'add')); ?>